﻿//Write a method that reverses the digits of given decimal number. Example: 256 -> 652


using System;

public class ReversesDigits
{
    public static void Main()
    {
        Console.WriteLine("Enter integer number");
        int number = int.Parse(Console.ReadLine());
        number = Reverse(number);
        Console.WriteLine("Reversed number is {0}", number);
    }

    private static int Reverse(int number)
    {
        int count = 0;
        int integer = number;
        do
        {
            number /= 10;           
            count++;
        } while (number > 0);

        for (int i = count - 1; i >= 0; i--)
        {
            int temp = integer % 10;
            number += temp * (int)Math.Pow(10, i);
            integer /= 10;
        }

        return number;
    }
}